package net.xdclass.controller;


import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.xdclass.core.KeyValue;
import net.xdclass.mq.RedisMqSmsProducer;
import net.xdclass.mq.RedisMqSmsSendConsumer;
import net.xdclass.mq.RedisMqSmsSendMessage;
import net.xdclass.service.AddressService;
import net.xdclass.utils.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;


/**
 * <p>
 * 电商-公司收发货地址表 前端控制器
 * </p>
 *
 * @author Chen
 * @since 2023-10-30
 */
@Tag(name = "收货地址模块",description = "收货地址模块")
@RestController
@RequestMapping("/api/address/v1/")
public class AddressController {
    @Autowired
    private AddressService addressService;

    @Resource
    private RedisMqSmsProducer redisMqSmsProducer;


    @Operation(summary = "根据id查看地址详情",description = "根据id查看地址详情")
    @GetMapping(value ="/find/{address_id}")
    public Object detail(
            @Parameter(description = "收货地址id",required = true)
                             @PathVariable("address_id") long addressId){

        List<KeyValue<String, Object>> keyValues = new ArrayList<>();
        redisMqSmsProducer.sendSmsSendMessage(1L, "110", 1L, "123", keyValues);

        return JsonData.buildSuccess(addressService.detail(addressId));
    }
}

